<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>H+ 后台主题UI框架 - 基本表单</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="../../css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="../../css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="../../css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="../../css/animate.min.css" rel="stylesheet">
    <link href="../../css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <!--自定义公共样式-->
    <link rel="stylesheet" href="../../css/common/common.ext.css?v=0.0.1">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-5">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改密码</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">旧密码：</label>
                            <div class="col-sm-8">
                                <input id="old_password" name="old_password" class="form-control" type="password">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">新密码：</label>
                            <div class="col-sm-8">
                                <input id="new_password" name="new_password" class="form-control" type="password">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">确认密码：</label>
                            <div class="col-sm-8">
                                <input id="confirm_password" name="confirm_password" class="form-control" type="password">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请再次输入您的密码</span>
                            </div>
                        </div>
                        <div class="error">用户名或者密码错误！</div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="button">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../js/jquery.min.js?v=2.1.4"></script>
<script src="../../js/tools/jquery.serialize.ext.js"></script>
<script src="../../js/tools/jquery.ajax.js"></script>
<script src="../../js/tools/init.js"></script>
<script src="../../js/jquery.cookie.js?v=2.1.4"></script>
<script src="../../js/bootstrap.min.js?v=3.3.6"></script>
<script src="../../js/content.min.js?v=1.0.0"></script>
<script src="../../js/plugins/iCheck/icheck.min.js"></script>
<script src="../../js/plugins/validate/jquery.validate.min.js"></script>
<script src="../../js/plugins/validate/messages_zh.min.js"></script>
<script>
    $(function(){
        $("button").click(function(){
            $("form").submit();

        });
    })

    $.validator.setDefaults({
        highlight: function(e) {
            $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
        },
        success: function(e) {
            e.closest(".form-group").removeClass("has-error").addClass("has-success")
        },
        errorElement: "span",
        errorPlacement: function(e, r) {
            e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
        },
        errorClass: "help-block m-b-none",
        validClass: "help-block m-b-none",
        submitHandler: function() {
            $.ajax({
                url:path+"/user/profile/pwd",
                type: "PUT",
                async: false,
                contentType: 'application/json',
                data:JSON.stringify($("form").serializeJson()),
                headers: {
                    'chomolungma-auth-token':$.cookie('chomolungma-auth-token')
                },
                success:function(result){
                    if(result.meta.success){
                        $(".error").hide();
                        alert("修改成功");
                        document.forms[0].reset();
                    }
                },
                error:function (result) {
                    var meta = eval("(" + result.responseText + ")").meta;
                    $(".error").text(meta.message).show();
                    document.forms[0].reset();
                }
            })
        }
    }),
        $().ready(function() {
            var e = "<i class='fa fa-times-circle'></i> ";
            $("#signupForm").validate({
                rules: {
                    old_password:{
                        required:!0,
                        minlength:5
                    },
                    new_password: {
                        required: !0,
                        minlength: 5
                    },
                    confirm_password: {
                        required: !0,
                        minlength: 5,
                        equalTo: "#new_password"
                    }
                },
                messages: {
                    old_password:{
                        required: e + "请输入您的密码",
                        minlength: e + "密码必须5个字符以上"
                    },
                    new_password: {
                        required: e + "请输入新密码",
                        minlength: e + "密码必须5个字符以上"
                    },
                    confirm_password: {
                        required: e + "请再次输入密码",
                        minlength: e + "密码必须5个字符以上",
                        equalTo: e + "两次输入的密码不一致"
                    }
                }
            })
        });

</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
</html>
